<template>
	<el-dialog title="预览" :append-to-body="true" :visible.sync="visible" :before-close="close" :close-on-click-modal="false" fullscreen>
		<el-button type="success" v-print="'#yfbStay'">打印</el-button>
		<p></p>
		<div id="yfbStay" class="yfbStay">
			<table width="320px" border="1px" style="line-height: 20px;font-family:arial,SimSun;">
				<tr>
					<td style="border-right:none;text-align: center;">
						<img src="../../../assets/img/printdispense-logo.png" />
					</td>
					<td colspan="5" style="border-left:none;text-align: center;">
						<b>物料留样标签卡</b>
						<br />
						SMP-QC-014-F01-01
					</td>
				</tr>
				<tr>
					<td style="text-align: center;">品&nbsp;&nbsp;&nbsp;名</td>
					<td colspan="5">&nbsp;{{checkList.productName}}</td>
				</tr>
				<tr>
					<td style="text-align: center;">编&nbsp;&nbsp;&nbsp;号</td>
					<td colspan="5">

					</td>
				</tr>
				<tr>
					<td style="text-align: center;">供应商</td>
					<td colspan="5">
						&nbsp;{{yfbInfo.supplierName}}
					</td>
				</tr>
				<tr>
					<td style="text-align: center;">原厂批号</td>
					<td colspan="2">
					&nbsp;{{yfbInfo.originalBatch}}
					</td>
					<td style="text-align: center;">数&nbsp;&nbsp;&nbsp;量</td>
					<td colspan="2">
					&nbsp;{{yfbInfo.groupGetQuantity}}{{yfbInfo.groupGetUnitName}}
					</td>
				</tr>
				<tr>
					<td style="text-align: center;">物料编码</td>
					<td colspan="5">
						&nbsp;{{checkList.batchNum}}
					</td>
				</tr>
				<tr>
					<td style="text-align: center;">有效期</td>
					<td colspan="2">
					&nbsp;{{yfbInfo.validityDateStr}}
					</td>
					<td style="text-align: center;">贮存至</td>
					<td colspan="2">
					&nbsp;{{yfbInfo.stay2Date}}
					</td>
				</tr>
				<tr>
					<td style="text-align: center;white-space:nowrap;">留样人/日期</td>
					<td colspan="5">

					</td>
				</tr>
				<tr>
					<td style="text-align: center;">贮存条件</td>
					<td colspan="5">
					&nbsp;{{checkList.storageConditions}}
					</td>
				</tr>
			</table>
		</div>
	</el-dialog>
</template>

<script>
	import { lybq } from '@/api/print'
	import {
		CODE_OK
	} from '@/common/js/config'
	import {
		isBlank,
		parseTime
	} from '@/common/js/utils'
	import Calc from 'calculatorjs'
	export default {
		data() {
			return {
				visible:false,
				yfbInfo:{}
			}
		},
		props: ["childDataForm"],
		created() {
			if (!isBlank(this.childDataForm)) {
				this.checkList = this.childDataForm.list
				lybq('yfb',this.checkList.checkId).then(res=>{
					if (res.code === CODE_OK) {
						this.yfbInfo = res.YfbStayInfo
						this.visible = true
					}else{
						this.$message.error(res.msg)
						this.close()
					}
				})
			}
		},
		methods: {
			close() {
				this.visible = false
				this.$emit('close')
			}
		}
	}
</script>

<style type="text/scss" lang="scss" scoped>

</style>
